var url = require('url'),
	path = require('path')
;
exports.rule ={
	ruleA:function($){
			var _aList = []
				,_alinks = $('.page a')
				,_url = $('.next a').attr('href')
				,_links = $('.ctn3_list a')
			;
			_alinks.each(function(i,n){
				if(n.children[0].data === '下一页'){
					_url = n.attribs.href;
				}
			})
			_links.each(function(i,n){
				_aList.push(n.attribs.href);
			});
			return {
				aList:_aList
				,nextUrl:_url
			};
	},
	ruleImg:function($){
		var _list = []
			,_img= $('#picView img')
			,_imgUrl = _img.attr('src')
			,_total = $('.dangqian font').eq(1).html().replace('/','')
			,_obj = url.parse(_imgUrl)
			,_basename = path.basename(_obj.path)
			,_ext = path.extname(_obj.path)
			,_comUrl = _imgUrl.replace(_basename,'')
		;
		_total = parseInt(_total,10);

		for(var i=1;i<=_total;i++){
			_list.push(_comUrl+i+_ext);
		}
		return _list;
	}
};
exports.url='http://www.mm8mm8.com/sexy/';
exports.encoding = 'gb2312';